# 怎样调用父类上被重写的方法? 两遍   super().属性名  super().方法名
# 定义商品类
class Goods:
    def __init__(self, name, price):
        self.name = name
        self.price = price
# 定义手机类
class Phone(Goods):
    def __init__(self, name, price, capacity, size):
        super().__init__(name, price)                 # 子类调用父类的方法
        self.capacity = capacity
        self.size = size

p1 = Phone('iPhone13', 5399, '256G', '7')
print(p1.name)
print(p1.price)
print(p1.capacity)
print(p1.size)

# 定义商品类
class Goods:
    def __init__(self, name, price):
        self.name = name
        self.price = price
# 定义手机类
class Phone(Goods):
    def __init__(self, name, price, capacity, size):
        super().__init__(name, price)                          # 子类调用父类的方法
        self.capacity = capacity
        self.size = size

p1 = Phone('iPhone11', 5499, '128G', '7')
print(p1.name)
print(p1.price)
print(p1.capacity)
print(p1.size)



